In a technical field of FA (factory automation), a programmable controller (hereafter referred to as a “PLC”) is used to control various kinds of devices. The PLC is applied to various kinds of unitary industrial machines, such as machine tools, automatic assembling machines and automatic welding machines. Herein, the PLC is constituted of a computer having a CPU, a ROM and a RAM. And some PLCs have a self-diagnosis function of performing the self-diagnosis as to whether there is any breakdown inside the PLC to secure enough reliability for the PLC itself to operate normally. The above-mentioned self-diagnosis is performed at an appropriate time after the power is turned on in the PLC. The self-diagnosis performed in preparation before the PLC starts the usual operation immediately after the power is turned on is hereafter referred to as an “initial self-diagnosis”, and the self-diagnosis repeatedly performed at appropriate times during the usual operation of the PLC is hereinafter referred to as a “normal self-diagnosis”.
The self-diagnosis mainly involves inspecting whether or not the RAM is normal. Generally, as the self-diagnosis, two or more memory areas to which the address is individually allocated are inspected sequentially in the sequence of the address. Referring to FIG. 7, this will be specifically described below.
First of all, the data stored in all the memory areas to be inspected from the first address to the nth address is stored in a stack as the backup. Next, it is checked whether or not the data for inspection is correctly written into the memory area in the first address, and the data of the memory areas in other addresses from the second address to the nth address are unchanged by comparing the data of the memory areas in other addresses with the backed up data. Thereby, it is possible to inspect whether the memory area in the first address is not opened (ruptured), and the memory area in the first address is not shorted (short-circuited) with other memory areas.
Such inspection of the memory area is sequentially performed for each memory area in the second address and beyond in the sequence of the address. Herein, for the inspection of the memory area in the second address and beyond, it is unnecessary to compare the memory area where the inspection is already completed, such as the memory area in the first address, with the backed up data, because it is checked not to be short-circuited with other memory areas. Therefore, the memory area where the inspection is already completed is saved.
All the memory areas to be inspected are repeatedly inspected by n times in total, and upon completing the inspection of the memory area in the last nth address, the inspection of all the memory areas to be inspected is completed, that is, the self-diagnosis of one cycle is ended.
In the conventional PLC, the self-diagnosis of one cycle is performed as an initial self-diagnosis immediately after turning on the power, or as a normal self-diagnosis during the normal operation. Herein, though in the initial self-diagnosis, the self-diagnosis of one cycle is performed continuously through a series of processings, the PLC during the normal operation can not secure a sufficient spare time for performing the self-diagnosis of one cycle continuously through a series of processings, because a process for controlling various devices is always performed. Hence, for the normal self-diagnosis, the self-diagnosis of one cycle is not performed continuously through a series of processings, but subdivided, using the spare time allotted to the self-diagnosis. In the conventional PLC, though it is natural that in the initial self-diagnosis the inspection is started from the memory area in the top address, the inspection is started from the memory area in the top address in the normal self-diagnosis at the first time after the power is turned on.
The above-mentioned background art is the general matter, and the present applicant knows no documents having a description of specifying this background art at the time of application.